package com.youhome.service.utils;

import org.jfree.chart.renderer.category.BarRenderer;

import java.awt.*;

/**
 * Created by chen365 on 2018/08/29.
 */
public class CustomRender extends BarRenderer {

    private Paint[] colors;
    // 初始化柱子颜色
    private String[] colorValues = { "#FF0000", "#0070C0","#00AF4E","#7030A0" };

    public CustomRender() {
        colors = new Paint[colorValues.length];
        for (int i = 0; i < colorValues.length; i++) {
            colors[i] = Color.decode(colorValues[i]);
        }
    }
    // 每根柱子以初始化的颜色不断轮循
    public Paint getItemPaint(int i, int j) {
        return colors[j % colors.length];
    }
}
